<!DOCTYPE html>


<html lang="zn-CH">


<head>
  <meta charset="utf-8" />
    
  <meta name="description" content="What I can do is to Do My Personal Best!" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    Geode集群搭建 |  小熊的博客
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="http://www.cdn.adingxiong.com/b5363a06dc744d79a94021492bcefe27" />
  
  
<link rel="stylesheet" href="/blog/dist/main.css">

  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">

  
<link rel="stylesheet" href="/blog/css/custom.css">

  
  
<script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>

  
  

  

<link rel="alternate" href="/blog/atom.xml" title="小熊的博客" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content on">
      <section class="outer">
  <article id="post-geode" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  Geode集群搭建
</h1>
 

    </header>
    

    
    <div class="article-meta">
      <a href="/blog/2020/04/18/geode/" class="article-date">
  <time datetime="2020-04-18T05:47:36.268Z" itemprop="datePublished">2020-04-18</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/blog/categories/Geode/">Geode</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> Word count:</span>
            <span class="post-count">1.4k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> Reading time≈</span>
            <span class="post-count">5 min</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      
      

      
      <h1 id="Geode集群搭建"><a href="#Geode集群搭建" class="headerlink" title="Geode集群搭建"></a>Geode集群搭建</h1><h2 id="geode介绍"><a href="#geode介绍" class="headerlink" title="geode介绍"></a>geode介绍</h2><ol>
<li><p>Geode/Gemfire 是Pivotal公司开发的一款开源的、分布式NoSql内存数据库，可用来进行完成分布式缓存，数据持久化，分布式事物、动态扩展等功能。</p>
</li>
<li><p>Geode是一个提供实时、一致访问大型分布式云平台下数据密集型应用的数据管理平台。</p>
</li>
<li><p>Geode 通过跨多进程，把内存、CPU、网络资源和可选的本地磁盘汇集起来，来管理应用程序对象及其行为。它使用动态复制和数据分片技术，来实现高可用性，改善性能、可伸缩性和容错。Geode 除了是一个分布式数据容器，它还是一个内存数据管理系统，提供了可靠的异步事件通知和有保证的消息传递。</p>
</li>
</ol>
<h2 id="基本概念"><a href="#基本概念" class="headerlink" title="基本概念"></a>基本概念</h2><ol>
<li><p>定位器（Locator）： 提供发现服务和负载均衡服务。您可通过定位器服务列表来配置客户端，定位器管理维护着一个动态成员服务器（server）列表，和链接不同的server。</p>
</li>
<li><p>服务器（server） ： 主要用于托管长期数据区域和运行标准Geode进程，例如客户端/服务器配置中的服务器。服务器（server），可以部署在同一台机器，也可以部署在不同机器。在不同的机器上启动时，需要先用connect连接已启动的locator</p>
</li>
<li><p>区域（region） ：   类似于关系型数据库的表，并且作为“name/value 对”以分布式方式管理数据。复制区域（replicated region）存储着 {分布式系统中每个缓存成员数据的} 相同副本。分区区域（partitioned region）在缓存成员之间传播数据。系统配置之后，客户端应用 {在不了解底层系统架构的情况下} 也可访问区域中的分布式数据。当数据发生改变的时候，您可以定义监听器来接收通知，并且您也可以定义过期条件，来删除区域中的过期数据。</p>
</li>
</ol>
<h2 id="集群配置服务的原理"><a href="#集群配置服务的原理" class="headerlink" title="集群配置服务的原理"></a>集群配置服务的原理</h2><ol>
<li><p>定位器（locator）：一个Geode进程，它告诉新的连接成员正在运行的成员的位置，并为服务器的使用提供负载均衡。默认情况下，定位器启动JMX Manager，该JMX Manager用于监视和管理Geode集群。集群配置服务使用定位器来保持集群配置并将配置分配给集群成员。</p>
</li>
<li><p>服务器（Server）:分为2个级别：集群和组，组级别可以覆盖集群级别的配置</p>
</li>
</ol>
<h2 id="geode的安装"><a href="#geode的安装" class="headerlink" title="geode的安装"></a>geode的安装</h2><ol>
<li><p>首先去官网下载你系统所支持的版本压缩包   <a href="https://geode.apache.org/" target="_blank" rel="noopener">https://geode.apache.org/</a></p>
</li>
<li><p>将压缩包解压到指定的文件夹<strong>jdk版本必须是1.8以上</strong></p>
</li>
<li><p>预先创建好一个工作空间，用于部署定位器和服务器，例如我这里是在创建的是 <code>D:\geode\leap</code>目录，</p>
</li>
</ol>
<h3 id="geode的调试准备"><a href="#geode的调试准备" class="headerlink" title="geode的调试准备"></a>geode的调试准备</h3><ol>
<li><p>配置文件的更改，找到<code>geode</code>解压包的路径,找到<code>bin</code>目录下的<code>leap.properties</code>配置文件，将下面位置的ip改为自己本机的地址。</p>
<p> <img src="http://pkzuokcq8.bkt.clouddn.com/myfile/20190125095807.png" alt></p>
</li>
<li><p>将更改后的配置文件，复制到<code>D:\geode\leap</code>目录下。</p>
</li>
<li><p>回到<code>geode</code>解压包<code>bin</code>目录下,按住shift键鼠标右键，点击<em>在此处打开命令窗口</em>，进入管理员界面，使用<code>gfsh</code>命令进入<code>geode</code>管理模式.</p>
 <figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="function">D:\自用项目包\<span class="title">projectresource</span>\<span class="title">LEAPV5</span>资源\发布库\<span class="title">V6</span>\<span class="title">geode</span>\<span class="title">apache</span>-<span class="title">geode</span>-1.6.0\<span class="title">bin</span>&gt;<span class="title">gfsh</span></span></span><br><span class="line"><span class="function">    <span class="title">_________________________</span>     <span class="title">__</span></span></span><br><span class="line"><span class="function">/ <span class="title">_____</span>/ <span class="title">______</span>/ <span class="title">______</span>/ /<span class="title">____</span>/ /</span></span><br><span class="line"><span class="function">/ /  <span class="title">__</span>/ /<span class="title">___</span>  /<span class="title">_____</span>  / <span class="title">_____</span>  /</span></span><br><span class="line"><span class="function">/ /<span class="title">__</span>/ / <span class="title">____</span>/  <span class="title">_____</span>/ / /    / /</span></span><br><span class="line"><span class="function">/<span class="title">______</span>/<span class="title">_</span>/      /<span class="title">______</span>/<span class="title">_</span>/    /<span class="title">_</span>/    1.6.0</span></span><br><span class="line"><span class="function"></span></span><br><span class="line"><span class="function"><span class="title">Monitor</span> <span class="title">and</span> <span class="title">Manage</span> <span class="title">Apache</span> <span class="title">Geode</span></span></span><br><span class="line"><span class="function"><span class="title">gfsh</span>&gt;</span></span><br></pre></td></tr></table></figure></li>
<li><p>如果没有进入到这个界面，可能是环境变量的问题，可以回去检查java环境变量是否配置。</p>
</li>
<li><p>开始<strong>创建定位器</strong>，并将其部署到指定的工作控件，<em>locator 定位器，相当于master-slave中的master，或者zookeeper，主要用于管理集群，和链接不同的server</em></p>
 <figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">start</span> locator --name=locator_leap1  --hostname-<span class="keyword">for</span>-clients=<span class="number">192</span>.<span class="number">168</span>.<span class="number">5</span>.<span class="number">130</span> --port=<span class="number">30001</span> --http-service-port=<span class="number">34001</span> --properties-file=D:/geode/leap/leap.properties --J=-Dp2p.handshakeTimeoutMs=<span class="number">75000</span>  --J=-Djava.<span class="built_in">net</span>.preferIPv4Stack=true --<span class="built_in">dir</span>=D:/geode/leap/locator_leap1</span><br></pre></td></tr></table></figure></li>
<li><p>需要注意的是，这里的定位器名字和端口可以自己指定，如果不指定的话一般也可以自动生成，然后接着<strong>创建一个服务器</strong></p>
 <figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">start</span> server --name=server_leap1  --hostname-<span class="keyword">for</span>-clients=<span class="number">192</span>.<span class="number">168</span>.<span class="number">5</span>.<span class="number">130</span> --server-port=<span class="number">35001</span>  --locators=<span class="number">192</span>.<span class="number">168</span>.<span class="number">5</span>.<span class="number">130</span>[<span class="number">30001</span>]  --initial-heap=<span class="number">1</span>G --max-heap=<span class="number">1</span>G --critical-heap-percentage=<span class="number">95</span> --eviction-heap-percentage=<span class="number">60</span> --off-heap-memory-size=<span class="number">3</span>G --critical-off-heap-percentage=<span class="number">95</span> --eviction-off-heap-percentage=<span class="number">60</span> --J=-Dgemfire.ALLOW_PERSISTENT_TRANSACTIONS=true --J=-Dp2p.handshakeTimeoutMs=<span class="number">75000</span> --J=-Djava.<span class="built_in">net</span>.preferIPv4Stack=true  --properties-file=D:/geode/leap/leap.properties --<span class="built_in">dir</span>=D:/geode/leap/server_leap1</span><br></pre></td></tr></table></figure></li>
<li><p><code>list members</code>列出创建成功的服务器和定位器</p>
</li>
<li><p>创建一个复制,持久化的区域(<code>region</code>:相当于传统数据库的数据表)</p>
<p> <code>create region --name=regionA --type=REPLICATE_PERSISTENT</code></p>
</li>
<li><p>向<code>region</code>中添加，查询数据</p>
<p> <code>put --region=regionA --key=&quot;1&quot; --value=&quot;one&quot;</code></p>
<p> <code>query --query=&quot;select * from /regionA&quot;</code></p>
</li>
<li><p>查看有关区域的详细信息</p>
<p><code>gfsh&gt;describe region --name=regionA</code></p>
</li>
<li><p>开启监控web界面：默认的用户名密码为 <code>admin</code></p>
<p><code>start pulse</code></p>
</li>
<li><p>停止服务器</p>
<p><code>stop server --name=server_leap1</code></p>
</li>
<li><p>停止集群 </p>
<p><code>shutdown include-locators=true</code></p>
</li>
<li><p>导入集群</p>
<p><code>export cluster-configuration --zip-file-name=/home/username/configs/myClusterConfig.zip</code> </p>
</li>
<li><p>导出集群</p>
<p><code>import cluster-configuration --zip-file-name=/home/username/configs/myClusterConfig.zip</code></p>
</li>
<li><p>连接集群</p>
<p><code>connect --locator=localhost[30033]</code></p>
</li>
<li><p>使用geode查询数据，先连接到指定的集群，然后执行以下命令</p>
<p><code>query --query = &quot;select * from regionA</code></p>
</li>
</ol>
<h3 id="geode其他命令"><a href="#geode其他命令" class="headerlink" title="geode其他命令"></a>geode其他命令</h3><ul>
<li>启动gfhs  <code>gfsh</code></li>
<li>启动定位器        <code>start locator --name=locatorName</code></li>
<li>检查存在的gfsh连接     <code>describe connection</code></li>
<li>从不同的终端连接定位器和JMX管理员   <code>connect</code></li>
<li>断开所有的连接  <code>disconnect</code></li>
<li>从另外的终端连接定位器    <code>start server --name=server1 --locators=localhost[10334]</code></li>
<li>列出所有的成员    <code>list members</code></li>
<li>查看成员详情      <code>describe  member --name=serverName(locatorName)</code></li>
</ul>

      
      <!-- reward -->
      
      <div id="reward-btn">
        Donate
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>Copyright： </strong>
              Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://bodboy.gitee.io/blog/2020/04/18/geode/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/blog/tags/Geode/" rel="tag">Geode</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/blog/2020/04/18/geode%E5%AE%89%E8%A3%85/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            geode的安装部署
          
        </div>
      </a>
    
    
      <a href="/blog/2020/04/18/docker%E7%9A%84%E5%AE%89%E8%A3%85/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">docker的相关操作</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'uW8QYGvvhWmNWdiwpznJ0GVa-gzGzoHsz',
        app_key: 'LrJhMzx9qEwcMV1DJjTI6f6C',
        path: window.location.pathname,
        notify: 'false',
        verify: 'false',
        avatar: '[object Object]',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2019-2021
        <i class="ri-heart-fill heart_icon"></i> panda
      </li>
    </ul>
    <ul>
      <li>
        
        
        
        Powered by <a href="https://hexo.io" target="_blank">Hexo</a>
        <span class="division">|</span>
        Theme - <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>Visitors:<span id="busuanzi_value_site_uv"></span></s>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>Views:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="float_btns">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

      </div>
    </main>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/blog/"><img src="https://portrait.gitee.com/uploads/avatars/user/1007/3023420_bodboy_1578973210.png!avatar200" alt="小熊的博客"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/tags/%E6%97%85%E8%A1%8C/">旅行</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/blog/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/blog/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <script>
      if (window.matchMedia("(max-width: 768px)").matches) {
        document.querySelector('.content').classList.remove('on');
        document.querySelector('.sidebar').classList.remove('on');
      }
    </script>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/blog/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/blog/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/blog/js/jquery-2.0.3.min.js"></script>


<script src="/blog/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/blog/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto'
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/blog/dist/main.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>


<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
  var ayerConfig = {
    mathjax: true
  }
</script>




<script src="/blog/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>

  
<script src="/blog/js/clickLove.js"></script>



<!-- 复制 -->



    
    <div id="music">
    
    
    
    <iframe frameborder="no" border="1" marginwidth="0" marginheight="0" width="200" height="52"
        src="//music.163.com/outchain/player?type=2&id=1297802566&auto=1&height=32"></iframe>
</div>

<style>
    #music {
        position: fixed;
        right: 15px;
        bottom: 0;
        z-index: 998;
    }
</style>
    
  </div>
</body>

</html>